<%@ Page Language="C#" MasterPageFile="~/admin/admin1.master" AutoEventWireup="true" ValidateRequest="False" CodeFile="Categories.aspx.cs" Inherits="admin_Pages_Categories" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphAdmin" Runat="Server">

<br />

<div class="settings">
  
  <h1 style="margin: 0 0 5px 0"><%=Resources.labels.edit + " " + Resources.labels.category%> </h1>

  <asp:Label ID="lblTitle" runat ="server" AssociatedControlID="txtTitle" Text="Title" />
  <asp:TextBox runat="Server" ID="txtTitle" Width="200" />
  <asp:CustomValidator runat="Server" ID="valExist" ValidationGroup="new" ControlToValidate="txtTitle" ErrorMessage="The category already exists" Display="dynamic" />
  <asp:RequiredFieldValidator runat="Server" ID="valRequired" ValidationGroup="new" ControlToValidate="txtTitle" ErrorMessage="Please enter a valid name" /><br />
  <asp:Label ID="lblSlug" runat ="server" AssociatedControlID="txtSlug" Text="Slug" />
  <asp:TextBox runat="Server" ID="txtSlug" Width="200" /><br />
  <asp:Label ID="lblDescription" runat ="server" AssociatedControlID="txtDescription" Text="Description" />
  <asp:TextBox runat="Server" ID="txtDescription" Width="400" TextMode="MultiLine" Rows="4" /><br />
  <label for="<%=ddlParent.ClientID %>"><%=Resources.labels.selectParent %></label>
  <asp:DropDownList runat="server" id="ddlParent" /><br /><br />
  <label for="<%=txtOrder.ClientID %>"><%=Resources.labels.order%></label>
  <asp:TextBox runat="server" ID="txtOrder" Width="50" MaxLength="4" />
  <asp:CompareValidator ID="txtOrderValidator" ValidationGroup="new" runat="server" ControlToValidate="txtOrder" Operator="DataTypeCheck" Type="integer" ErrorMessage="Please enter a valid number" /><br />
  <asp:Button runat="server" ID="btnAdd" ValidationGroup="new" /><br /><hr />

  <asp:GridView runat="server" ID="grid" CssClass="category" 
    GridLines="None"
    AutoGenerateColumns="False" 
    AlternatingRowStyle-CssClass="alt" 
    AutoGenerateDeleteButton="True" 
    AutoGenerateEditButton="False">
    <Columns>  
      <asp:HyperLinkField DataNavigateUrlFields="Id" DataNavigateUrlFormatString="?id={0}" Text="Edit" />
      <asp:TemplateField HeaderText="<%$ Resources:labels, name %>">
        <ItemTemplate>
          <%# Server.HtmlEncode(Eval("title").ToString()) %>
        </ItemTemplate>
      </asp:TemplateField>
      <asp:TemplateField HeaderText="<%$ Resources:labels, slug %>">
        <ItemTemplate>
          <%# Server.HtmlEncode(Eval("slug").ToString()) %>
        </ItemTemplate>
      </asp:TemplateField>
      <asp:TemplateField HeaderText="<%$ Resources:labels, description %>">
       <ItemTemplate>
          <%# Server.HtmlEncode(Eval("description").ToString())%>
        </ItemTemplate>
      </asp:TemplateField>
    </Columns>
      <AlternatingRowStyle CssClass="alt" />
  </asp:GridView>
  
  </div>
</asp:Content>